package WaiBao;

import java.util.Arrays;

public class LuoJingWen {
    public static void main(String[] args) {
        String[] name= {"于动然(班长)", "李婷婷(副班长)", "小李(学习委员)", "张小华(团支书)", "伪装", "枷锁", "小锦儿", "北慕", "涵涵", "赖神", "吕德华", "廷安",
                "听安", "楚河", "嗨氏", "余量", "旧梦", "袁熙", "副词", "神算", "杨昊天", "孙保叔", "张大庆", "李德宝", "杨玉环", "貂蝉", "西施", "奕星",
                "王金文", "罗婧雯(学生)"};//考生本人:罗婧雯(学生)
        int[] age = {20, 21, 19, 20,22, 21, 21, 21, 18, 22,19, 21, 21, 19, 21,20, 18, 18, 20, 18, 19,20, 20, 20, 20, 21, 19,20,21, 20};//考生年龄：20岁

        double[] mosters1 = {71, 66, 84, 91, 61, 71, 88, 88, 77, 97, 83, 77, 85, 77, 65, 68, 69, 99, 96, 88, 82, 91, 95, 88, 75, 74, 84, 76, 84, 96};
        double[] mosters2 = {65, 74, 84, 76, 74, 83, 84, 84, 94, 84, 91, 81, 84, 76, 61, 65, 86, 74, 86, 68, 82, 75, 90, 86, 75, 87, 78, 85, 90, 96};
        double[] mosters3 = {74, 66, 91, 84, 74, 69, 88, 89, 80, 68, 83, 87, 85, 75, 65, 61, 89, 69, 96, 93, 95, 81, 85, 95, 79, 84, 77, 78, 69, 96};

        double boom1;//代表每个学生的总分
        double boom2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            boom1 =mosters1[i] +mosters2[i] +mosters3[i];
//            boom2 = (boom1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + boom1);
//            System.out.println(name[i] + "的平均分为:" +boom2);
//        }


        double jieguo1 = 0, jieguo2 = 0;
        double[] star = new double[30];
//        for (int i = 0; i < 30; i++) {
//            jieguo1 =mosters1[i] + mosters2[i] +mosters3[i];
//            jieguo2= (jieguo1 * 1.0) / 3;
//            star[i] = jieguo2;
//        }
//
//        for (int i = 0; i < star.length - 1; i++) {
//            for (int j = 0; j <star.length - i - 1; j++) {
//                if (star[j] < star[j + 1]) {
//                    double tep =star[j];
//                    star[j] =star[j + 1];
//                    star[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(star[i]);
//        }


        double juanzi1 = 0,juanzi2 = 0, juanzi3 = 0;//计算每门课的平均分
        double bamboo1 = 0,bamboo2 = 0, bamboo3 = 0;//计算每门课标准差
        double bofang1 = 0,bofang2 = 0,bofang3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i <mosters1.length; i++) {
//            sum2+=mosters1[i];
//        }
//        juanzi1 = (sum2*1.0)/30;
//        System.out.println("生物化学的班级平均分为:"+juanzi1);
//        double Sum = 0;
//        for (int i = 0; i <mosters2.length; i++) {
//            Sum+=mosters2[i];
//        }
//        juanzi2 = (Sum*1.0)/30;
//        System.out.println("微生物学的班级平均分为:"+juanzi2);
//        double sum = 0;
//        for (int i = 0; i <mosters3.length; i++) {
//            sum+=mosters3[i];
//        }
//        juanzi3 = (sum*1.0)/30;
//        System.out.println("人体组织解剖学的班级平均分为:"+juanzi3);
//
//
//
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i <mosters1.length; i++) {
//            c1+= (mosters1[i] -juanzi1)*(mosters1[i] - juanzi1);
//        }
//        bamboo1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:"+bamboo1);
//
//        for (int i = 0; i < mosters2.length; i++) {
//            c2+= (mosters2[i] -juanzi2)*(mosters2[i] - juanzi2);
//        }
//        bamboo2 = Math.sqrt(c2*1.0/30);
//        System.out.println("微生物学的班级标准差为:"+bamboo2);
//
//        for (int i = 0; i <mosters3.length; i++) {
//            c3+= (mosters3[i] -juanzi3)*(mosters3[i] - juanzi3);
//        }
//        bamboo3 = Math.sqrt(c3*1.0/30);
//        System.out.println("人体组织解剖学的班级标准差为:"+bamboo3);
////////////
//////////
        Arrays.sort(mosters1);
        Arrays.sort(mosters2);
        Arrays.sort(mosters3);
        bofang1 =( mosters1[14]+mosters1[15])*1.0/2;
        bofang2 =(mosters2[14]+mosters2[15])*1.0/2;
        bofang3 =(mosters3[14]+mosters3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+ bofang1);
        System.out.println("微生物学的中位数为:"+ bofang2);
        System.out.println("人体组织解剖学的中位数为:"+ bofang3);



    }
}
